<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="编号">
              <a-input placeholder="请输入编号" v-model="queryParam.number"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="单位">
              <a-input placeholder="请输入单位" v-model="queryParam.deptName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="模型名称">
              <a-input placeholder="请输入模型名称" v-model="queryParam.modelName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
            <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">清除条件</a-button>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      @change="handleTableChange"
    >
      <span slot="action" slot-scope="text, record">
        <a @click="handleCheck(record, '疑点梳理-详情')">详情</a>
        <a-divider type="vertical" />
        <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
          <a>删除</a>
        </a-popconfirm>
        <a-divider type="vertical" />
        <a @click="handleDownload(record)">下载</a>
      </span>
    </a-table>
    <!-- table区域-end -->
    <CheckModel ref="modalForm"></CheckModel>
  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CheckModel from './CheckModel'
import columns from './indexColumns'

export default {
  name: 'ydsl',
  mixins: [JeecgListMixin],
  components: {
    CheckModel
  },
  data() {
    return {
      queryParam: {},
      columns: columns(this),
      url: {
        list: '/sjmx2/modelTemplatePointSort/list',
        delete: '/sjmx2/modelTemplatePointSort/delete'
      }
    }
  },
  computed: {},
  methods: {
    handleDownload(record) {
      if (!record.path) {
        this.$message.error('很抱歉，资源未找到!')
        return
      }
      this.$message.success('正在下载，请稍等！')
      let url = `${window._CONFIG['domianURL']}/sys/common/static${record.path}`
      window.open(url, '_blank')
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>